package com.netease.nie.dao;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.netease.nie.mapper.UserInfoMapper;
import com.netease.nie.mapper.UserMapper;
import com.netease.nie.model.User;

/**
 * 
 * @author wwbn3695
 * @createDate July 22nd,2016
 *
 */
@Repository
public class UserDao {

	@Resource
	private UserMapper userMapper;
	
	@Resource
	private UserInfoMapper userInfoMapper;
	
	public Long queryUserIdBySsn(String ssn) {
		return userMapper.queryUserIdBySsn(ssn);
	}
	
	public Long registerUser(User user) throws Exception {
		userMapper.registerUser(user);
		return user.getUserId();
	}
	
	public User queryUserInfoByUserId(Long userId) {
		return userInfoMapper.queryUserInfoByUserId(userId);
	}
	
	public int saveUserInfo(User user) {
		return userInfoMapper.saveUserInfo(user);
	}
}
